package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo05 {
    public static void main(String[] args) {
        try (Connection conn = DBUtils.getConn();){
            Statement s = conn.createStatement();
            s.execute("create table hero(id int primary key auto_increment,name varchar(20),money decimal(10,2))");
//            int a = s.executeUpdate("insert into hero(name,money) values('小王',20000.00),('小李',10000.25),('小张',15000.23)");
//            System.out.println("创建完毕!"+"总共: "+a+"条数据");
//            ResultSet rl = s.executeQuery("select * from hero");
//            while(rl.next()){
//                int id = rl.getInt(1);
//                String name = rl.getString(2);
//                double money = rl.getDouble(3);
//                System.out.println(id+"\t"+name+"\t"+money);
//            }
//            s.executeUpdate("drop table hero");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
